package com.administration.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.core.entity.BaseEntity;

@Entity
@Table(name = "privilege")
public class Privilege extends BaseEntity {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "recid", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long recid;

	@Column(name = "name", length = 100)
	private String name;

	@Column(name = "parent_id")
	private String parentId;

//	@ManyToOne(optional=true)
//	@JoinColumn(name = "parent_id", insertable = false, updatable = false)
//	private Privilege parentPrivilege;

	@Column(name = "resource_key", length = 250)
	private String resourceKey;

	@Column(name = "url", length = 250)
	private String url;

	@Column(name = "icon", length = 250)
	private String icon;

	@Column(name = "category_id")
	private Long categoryId;

	// @ManyToMany(cascade = CascadeType.ALL)
	// @JoinTable(name = "group_privileges", joinColumns = { @JoinColumn(name =
	// "privilage_id") }, inverseJoinColumns = { @JoinColumn(name = "group_id")
	// })
	// private List<Group> groups;

	public Privilege() {
	}

	@Override
	public String toString() {
		return "Privilege [recid=" + recid + ", name=" + name + ", parentId=" + parentId + ", resourceKey=" + resourceKey + ", url=" + url + ", icon=" + icon + ", categoryId=" + categoryId + "]";
	}

	public void setRecid(Long recid) {
		this.recid = recid;
	}

	public Long getRecid() {
		return recid;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public final String getParentId() {
		return parentId;
	}

	public final void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public final String getResourceKey() {
		return resourceKey;
	}

	public final void setResourceKey(String resourceKey) {
		this.resourceKey = resourceKey;
	}

	public final String getUrl() {
		return url;
	}

	public final void setUrl(String url) {
		this.url = url;
	}

	public final String getIcon() {
		return icon;
	}

	public final void setIcon(String icon) {
		this.icon = icon;
	}

//	public void setParentPrivilege(Privilege parentPrivilege) {
//		this.parentPrivilege = parentPrivilege;
//	}
//
//	public Privilege getParentPrivilege() {
//		return parentPrivilege;
//	}

}
